﻿namespace Company.Shell.Dialogs
{
    public class DialogResult<TResult>
    {
        public DialogResult(IDialogViewModel<TResult> vm)
        {
            if(vm != null)
            {
                Result = vm.Result;
                Success = vm.Success;
            }
        }
        /// <summary>
        /// 对话框返回的结果
        /// </summary>
        public TResult? Result { get;  }
        /// <summary>
        /// 用户按下对话框的确定状态
        /// </summary>
        public bool Success { get; private set; }

        public void SetSuccess(bool? success)
        {
            if (success != null) 
            {
                Success = success.Value;
            }
        }
    }
}
